<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>惊蛰的博客 初学者进——前端女友帮助整理前端常用css样式（极其有用）</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <style>
        @import url('/css/post-card.css');
        @import url('/css/main.css');
        @import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,600;1,400;1,600&family=Roboto+Slab:wght@700&display=swap');
    </style>
    <style>
        body {
            font-family: Montserrat, sans;
        }

        .page-footer {
            color: var(--text-p3);
        }

        .sitemap {
            display: flex;
            justify-content: space-between;
            margin: .5rem 0 2rem;
            display: grid;
            grid-gap: 1rem 1rem;
            grid-auto-flow: column dense;
        }

        .sitemap-group {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
        }

        .sitemap-group>.fs14 {
            margin: .5rem 0;
        }

        .page-footer .sitemap .sitemap-group>a {
            margin: .2rem 0;
            color: var(--text-p3);
        }

        .page-footer .text p {
            margin: 4px 0;
            line-height: 1.2;
        }
    </style>
    <script src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js"></script>
    <script src="/js/index.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/jquery.scrollbar/0.2.9/jquery.scrollbar.min.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery_lazyload/1.9.7/jquery.lazyload.min.js"></script>
<meta name="generator" content="Hexo 5.4.0"></head>

<body>
    
<div class="l_body">
    <div class="l_main list">
        
<div class="nav-wrap mobile-hidden">
    <nav class="sub post cap header1">
        <a  href="/">最近发布</a>
        <a 
            href="/wiki/">分类</a>
        <a 
            href="/notes/">标签</a>
        <a href="/bibi/">说说</a>

    </nav>
    <div class="post-body-title header2">
        初学者进——前端女友帮助整理前端常用css样式（极其有用）
    </div>
</div>

<style>
    .sub2 {
        display: flex;
        flex-direction: column;
        position: absolute;
        z-index: 11;
        background:#ffff!important;
        border-radius: 5px;
    }

    .sub2 a{
        display: block;
        margin-left: 0px!important;
        border-radius: 5px;
        margin: 5px 0 3px 0!important;
    }
</style>


<script>
    $(function () {
        //页面初始化的时候，获取滚动条的高度（上次高度）
        var start_height = $(document).scrollTop();
        //获取导航栏的高度(包含 padding 和 border)
        var navigation_height = $('.header1').outerHeight();
        console.log(start_height, navigation_height);
        $(window).scroll(function () {
            //触发滚动事件后，滚动条的高度（本次高度）
            var end_height = $(document).scrollTop();
            console.log(end_height);
            //触发后的高度 与 元素的高度对比
            if (end_height > navigation_height) {
                $('.header1').addClass('hide');
                $('.header2').addClass('hide');
            } else {
                $('.header1').removeClass('hide');
                $('.header2').removeClass('hide');
            }
            //触发后的高度 与 上次触发后的高度 比较
            if (end_height < start_height) {
                $('.header1').removeClass('hide');
                $('.header2').removeClass('hide');
            }
            //再次获取滚动条的高度，用于下次触发事件后的对比
            start_height = $(document).scrollTop();
        });
    });
</script>


        <h2>
            初学者进——前端女友帮助整理前端常用css样式（极其有用）
        </h2>

        <div class="body-main-content">
            <p>html页面的元素有好多，分块儿级元素，行内元素，行内块儿级元素</p>
<p>块儿级元素 ：像div，p，h这种的，不管宽是多少都占一整行</p>
<p>行内元素：像span，a，label啊，i这种的，如果写好几个就挨着排队，而且width、margin-top,margin-bottom、padding-top对行内元素都没有用，</p>
<p>padding-left,right,bottom和margin-left、margin-right是好用的，也就是margin的竖直方向上数值无效，padding只有padding-top数值无效</p>
<p>1.子债父偿：<br>  一个父元素margin：0；子元素给定margin-top:10px;margin-top会出现在父元素上<br>  eg:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">&lt;style&gt;</span><br><span class="line">	.father&#123;</span><br><span class="line">		width:300px;</span><br><span class="line">		height:300px;</span><br><span class="line">		margin:0;</span><br><span class="line">	&#125;</span><br><span class="line">	.son&#123;</span><br><span class="line">		width:200px;</span><br><span class="line">		height:200px;</span><br><span class="line">		margin-top:10px;</span><br><span class="line">	&#125;</span><br><span class="line">&lt;/style&gt;</span><br><span class="line">&lt;div class=&quot;father&quot;&gt;</span><br><span class="line">	&lt;div class=&quot;son&quot;&gt;&lt;/div&gt;</span><br><span class="line">&lt;/div&gt;</span><br></pre></td></tr></table></figure>
<pre><code>解决：    1.给父级添加一个border；
        2.给父级添加一个新的属性overflow:hidden;
        3. 不适用margin，在父级中使用padding-top。
      
</code></pre>
<p>2.display:inline-block<br>    bug1:inline-block元素之间存在空白间隙（原因行内标签回车、换行、或者制表位的空白产生的）     1、font-size:0;     2、两个标签之间的换行注释掉<!----><br>    bug2:inline-block元素错位                vertical-align:middle;//必须是行内元素之间才能居中，浮动的元素不能对齐   </p>
<p>3.select清除默认样式</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">select&#123;</span><br><span class="line">		-webkit-appearance:none;</span><br><span class="line">		-moz-appearance:none;</span><br><span class="line">		appearance:none;</span><br><span class="line">		padding-right:15px;</span><br><span class="line">	&#125;</span><br><span class="line">	select::-ms-expand &#123; //清除ie的默认下拉框样式 隐藏下拉箭头</span><br><span class="line">		display: none;</span><br><span class="line">	&#125;</span><br></pre></td></tr></table></figure>
<p>4.table增加列，表格自动延伸，防止表格拥挤，并且超出显示滚动条</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">thead th&#123;    					//通过防止文字换行来实现表格自动延伸</span><br><span class="line">white-space：nowrap；</span><br><span class="line">overflow:visible;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>5.让div的滚动条始终贴在屏幕底部</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">让div相对于body绝对定位&#123;</span><br><span class="line">		position:absolute;或fixed</span><br><span class="line">		bottom:0;</span><br><span class="line">		top，left，right根据具体情况赋值</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<p>6.table内的标签始终贴在td上边，给td  vertical-align:top;   靠下同理 bottom</p>
<p>7.带滚动条的div里面的元素滚动到可视区域  document.getElementById(id).scrollIntoView();    //只能用dom获取，不能用jq获取元素</p>
<p>8.offset()获取距离时，该元素必须是可见元素</p>
<p>9.IE11下 table tr  visibility:hidden 时，td内容隐藏，边框不会隐藏，需要另外隐藏border:none;</p>
<p>10、触发fixed定位弹窗的a标签不能用href=“#”，否则会跳回页面顶部，用javascript：void(0)[推荐，没有href的话，多次点击a会出现文字选中效果]或者去除href</p>
<p>11、word-break：break-all 文字换行，允许在单词内换行,单词可能会被截断<br>                keep-all  只能在半角空格或连字符处换行。</p>
<pre><code>word-wrap:break-word 文字换行，英文单词过长时，整体换到下一行


white-space：处理空白 nowrap  不换行，直到遇见br（默认多个空格按一个空格处理的）
                      pre     不换行，正常显示空格
                      pre-wrap 保留空格，正常换行
                      pre-line 合并空格变成一个空格，保留编辑器写的换行符（即写代码时的回车换行）
                      normal  多个空格按一个空格处理
                      
                      
overflow-wrap:break-word;
</code></pre>
<p>12、多行超出省略</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">overflow : hidden;</span><br><span class="line">text-overflow: ellipsis;</span><br><span class="line">display: -webkit-box;</span><br><span class="line">-webkit-line-clamp: 2;</span><br><span class="line">-webkit-box-orient: vertical;</span><br></pre></td></tr></table></figure>


<p>13、ios单选按钮太丑</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">input[type=radio]&#123;</span><br><span class="line">      -webkit-appearance: none;</span><br><span class="line">      -moz-appearance: none;</span><br><span class="line">      appearance: none;</span><br><span class="line">      background: url(&quot;../web-images/radio1.png&quot;) no-repeat center;</span><br><span class="line">      padding: 0;</span><br><span class="line">      -webkit-background-size: 100%;</span><br><span class="line">      background-size: 100%;</span><br><span class="line">  &#125;</span><br><span class="line">  input[type=radio]:checked&#123;</span><br><span class="line">      background: url(&quot;../web-images/radio2.png&quot;) no-repeat center;</span><br><span class="line">      -webkit-background-size: 100%;</span><br><span class="line">      background-size: 100%;</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>

<p>14、滚动条样式</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">/*滚动条样式*/</span><br><span class="line"></span><br><span class="line">::-webkit-scrollbar&#123;</span><br><span class="line">    width:8px;</span><br><span class="line">    height:8px;</span><br><span class="line">&#125;</span><br><span class="line">::-webkit-scrollbar-track&#123;</span><br><span class="line">    background: #f6f6f6;</span><br><span class="line">    border-radius:4px;</span><br><span class="line">&#125;</span><br><span class="line">::-webkit-scrollbar-thumb&#123;</span><br><span class="line">    background: #aaa;</span><br><span class="line">    border-radius:4px;</span><br><span class="line">&#125;</span><br><span class="line">::-webkit-scrollbar-thumb:hover&#123;</span><br><span class="line">    background: #747474;</span><br><span class="line">&#125;</span><br><span class="line">::-webkit-scrollbar-corner &#123;</span><br><span class="line">    background: #f6f6f6;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



<p>15、高德地图android获取地理位置失败   (没试验过)</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;meta name=&quot;referrer&quot; content=&quot;never&quot;&gt;</span><br></pre></td></tr></table></figure>

<p>16、未知宽高图片在div内左右居中</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">.banner&#123;</span><br><span class="line">		width: 100%;</span><br><span class="line">		min-width: 1200px;</span><br><span class="line">		margin: 0 auto;</span><br><span class="line">		text-align: center;/*划重点*/</span><br><span class="line">		overflow: hidden;/*划重点*/</span><br><span class="line">	&#125;</span><br><span class="line">	.banner img&#123;</span><br><span class="line">		width: 1920px;</span><br><span class="line">		margin:0 -100%;/*划重点*/</span><br><span class="line">	&#125;</span><br></pre></td></tr></table></figure>


<p>17、左右始终居中对齐</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">父级标签样式：</span><br><span class="line">	display: flex;</span><br><span class="line">	-webkit-align-items: center;</span><br><span class="line">	align-items: center;</span><br><span class="line">	子级标签正常display:block;就可以</span><br><span class="line"></span><br></pre></td></tr></table></figure>


<p>18、placeholder  字体颜色</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">::-webkit-input-placeholder &#123; /* WebKit browsers */</span><br><span class="line">  color: #999;</span><br><span class="line">  font-size: 16px;</span><br><span class="line">&#125;</span><br><span class="line">::-moz-placeholder &#123; /* Mozilla Firefox 19+ */</span><br><span class="line">  color: #999;</span><br><span class="line">  font-size: 16px;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">:-ms-input-placeholder &#123; /* Internet Explorer 10+ */</span><br><span class="line">  color: #999;</span><br><span class="line">  font-size: 16px;</span><br><span class="line">&#125;   </span><br></pre></td></tr></table></figure>





<p>19、单边阴影</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line">.left&#123;</span><br><span class="line">	box-shadow:-5px 0 10px -5px #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.bottom&#123;</span><br><span class="line">	box-shadow:0 5px 10px -5px #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.right&#123;</span><br><span class="line">	box-shadow:5px 0 10px -5px #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.top&#123;</span><br><span class="line">	box-shadow:0px -5px 10px -5px #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.left-top&#123;</span><br><span class="line">	box-shadow:-5px -5px 10px  -4px #00ff00;            </span><br><span class="line">&#125;        </span><br><span class="line">.right-top&#123;</span><br><span class="line">	box-shadow:5px -5px 10px -4px #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.left-bottom&#123;</span><br><span class="line">	box-shadow:-5px 5px 10px -4px #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.right-bottom&#123;</span><br><span class="line">	box-shadow:5px 5px 10px -4px #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.no-left&#123;</span><br><span class="line">	/* .right-bottom,.right-top组合 */</span><br><span class="line">	box-shadow:5px 5px 10px -4px #00ff00,5px -5px 10px -4px  #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.no-bottom&#123;</span><br><span class="line">	/* .left-top,.right-top组合 */</span><br><span class="line">	box-shadow:-5px -5px 10px  -4px #00ff00,5px -5px 10px -4px  #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.no-right&#123;</span><br><span class="line">	/* .left-top，.left-bottom组合 */</span><br><span class="line">	box-shadow:-5px -5px 10px  -4px #00ff00,-5px 5px 10px -4px #00ff00;</span><br><span class="line">&#125;</span><br><span class="line">.no-top&#123;</span><br><span class="line">	/* .left-bottom,,right-bottom组合 */</span><br><span class="line">	box-shadow:-5px 5px 10px -4px #00ff00,5px 5px 10px -4px #00ff00;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>20、按钮hover从左到右颜色过渡</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line">.lx_fpMore a &#123;</span><br><span class="line">    font-size: 16px;</span><br><span class="line">    display: inline-block;</span><br><span class="line">    background-color: #ededed;</span><br><span class="line">    width: 169px;</span><br><span class="line">    height: 41px;</span><br><span class="line">    line-height: 41px;</span><br><span class="line">    text-align: center;</span><br><span class="line">    border-radius: 20.5px;</span><br><span class="line">     /*重点*/</span><br><span class="line">    position: relative; </span><br><span class="line">    transition: all 0.3s ease;</span><br><span class="line">    z-index: 1;</span><br><span class="line">    overflow: hidden;</span><br><span class="line">&#125;</span><br><span class="line"> /*重点*/</span><br><span class="line">.lx_fpMore a:after&#123;</span><br><span class="line">    position: absolute;</span><br><span class="line">    content: &#x27;&#x27;;</span><br><span class="line">    width: 0;</span><br><span class="line">    height:100%;</span><br><span class="line">    top:0;</span><br><span class="line">    right:0;</span><br><span class="line">    background: #d6d6d6;</span><br><span class="line">    -webkit-transition: all 0.3s ease;</span><br><span class="line">    -moz-transition: all 0.3s ease;</span><br><span class="line">    -ms-transition: all 0.3s ease;</span><br><span class="line">    -o-transition: all 0.3s ease;</span><br><span class="line">    transition: all 0.3s ease;</span><br><span class="line">    z-index: -1;</span><br><span class="line">    border-radius: 20.5px;</span><br><span class="line">&#125;</span><br><span class="line"> /*重点*/</span><br><span class="line">.lx_fpMore a:hover:after&#123;</span><br><span class="line">    width:100%;</span><br><span class="line">    left:0;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>21、css画三角形</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br></pre></td><td class="code"><pre><span class="line">#triangle-up &#123;</span><br><span class="line">    width: 0;</span><br><span class="line">    height: 0;</span><br><span class="line">    border-left: 50px solid transparent;</span><br><span class="line">    border-right: 50px solid transparent;</span><br><span class="line">    border-bottom: 100px solid red;</span><br><span class="line">&#125;</span><br><span class="line">#triangle-down &#123;</span><br><span class="line">    width: 0;</span><br><span class="line">    height: 0;</span><br><span class="line">    border-left: 50px solid transparent;</span><br><span class="line">    border-right: 50px solid transparent;</span><br><span class="line">    border-top: 100px solid red;</span><br><span class="line">&#125;</span><br><span class="line">#triangle-left &#123;</span><br><span class="line">    width: 0;</span><br><span class="line">    height: 0;</span><br><span class="line">    border-top: 50px solid transparent;</span><br><span class="line">    border-right: 100px solid red;</span><br><span class="line">    border-bottom: 50px solid transparent;</span><br><span class="line">&#125;</span><br><span class="line">#triangle-right &#123;</span><br><span class="line">    width: 0;</span><br><span class="line">    height: 0;</span><br><span class="line">    border-top: 50px solid transparent;</span><br><span class="line">    border-left: 100px solid red;</span><br><span class="line">    border-bottom: 50px solid transparent;</span><br><span class="line">&#125;</span><br><span class="line">#triangle-topleft &#123;</span><br><span class="line">    width: 0;</span><br><span class="line">    height: 0;</span><br><span class="line">    border-top: 100px solid red;</span><br><span class="line">    border-right: 100px solid transparent;</span><br><span class="line">&#125;</span><br><span class="line">#triangle-topright &#123;</span><br><span class="line">    width: 0;</span><br><span class="line">    height: 0;</span><br><span class="line">    border-top: 100px solid red;</span><br><span class="line">    border-left: 100px solid transparent;</span><br><span class="line"> </span><br><span class="line">&#125;</span><br><span class="line">#triangle-bottomleft &#123;</span><br><span class="line">    width: 0;</span><br><span class="line">    height: 0;</span><br><span class="line">    border-bottom: 100px solid red;</span><br><span class="line">    border-right: 100px solid transparent;</span><br><span class="line">&#125;</span><br><span class="line">#triangle-bottomright &#123;</span><br><span class="line">    width: 0;</span><br><span class="line">    height: 0;</span><br><span class="line">    border-bottom: 100px solid red;</span><br><span class="line">    border-left: 100px solid transparent;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

        </div>
        <div class="page-footer reveal fs12">
    <hr>
    <div class="sitemap">
        <div class="sitemap-group">
            <span class="fs14">博客</span>
            <a href="/">近期发布</a>
            <a href="/wiki/">分类</a>
            <a href="/notes/">标签</a>
            <a href="/archives/">归档</a>
        </div>
        <div class="sitemap-group">
            <span class="fs14">社交</span>
            <a target="_blank" rel="external nofollow noopener noreferrer" href="">GitHub</a>
            <a target="_blank" rel="external nofollow noopener noreferrer" href="">GitLab</a>
        </div>
        <div class="sitemap-group">
            <span class="fs14">更多</span>
            <a href="/about/">关于本站</a>
            <a href="/bibi/">哔哔</a>
            <a target="_blank" rel="external nofollow noopener noreferrer" href="https://image.jingzhe.xyz">图床</a>
        </div>
    </div>
    <div class="text">
        <p>本博客所有文章除特别声明外，均采用
            <a target="_blank" rel="external nofollow noopener noreferrer"
                href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
                CCBY-NC-SA 4.0
            </a>
            许可协议，转载请注明出处。
        </p>
    </div>
</div>
    </div>
    <aside class="l_right">
        
<header class="header">
    <div class="logo-wrap">
        <a class="avatar" href="/about/">
            <img class="avatar" src="" data-original="https://ae01.alicdn.com/kf/Ua26a9ebfe30847ff8d4d7d7c7647c61cH.jpg"></a>
        <a class="title" href="/">
            <div class="main">惊蛰</div>
            <div class="sub normal cap"></div>
            <div class="sub hover cap" style="opacity:0">jingzhe.xyz</div>
        </a>
    </div>
    <nav class="menu dis-select">
        <a class="nav-item " href="/">博客</a>
        <a class="nav-item " href="/archives/">归档</a>
        <a class="nav-item " href="/about/">关于</a>
    </nav>
</header>
<script>
    $(function () {
        // https://v1.hitokoto.cn/?c=f&encode=text&max_length=8
        $.ajax({
            url: "https://v1.hitokoto.cn/?c=f&encode=text&max_length=10&min_length=5&c=i",
            success: function (result) {
                $(".normal").html(result);
            }
        });

    })
</script>
<div class="widgets">
    <div class="widget-wrap">
    <div class="widget-header cap dis-select"><span class="name">目录</span></div>
    <div class="widget-body fs14 toc-body">
        
    </div>

    <!-- 
     -->
</div>

<script>
    // 让锚点位置下降80个点数
    $(".body-main-content *[id]").each(i => {
        $($(".body-main-content *[id]")[i]).attr('style', 'padding-top: 60px;margin-top: -60px;');
    })

    $(function () {
        $('.toc-link').click(function () {
            if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location
                .hostname == this.hostname) {
                var $target = $(this);
                $target = $('[id=' + decodeURI(this.hash.slice(1)) + ']');
                if ($target.length) {
                    var targetOffset = $target.offset().top;
                    $('html,body').animate({
                            scrollTop: targetOffset
                        },
                        700);
                    return false;
                }
            }
        });
    })
</script>
    <footer class="footer dis-select">
    <div class="social-wrap">
        <a class="social" title="GitHub" href="https://github.com/xaoxuu" target="_blank"
            rel="external nofollow noopener noreferrer"><img class="lazy entered loaded"
                src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/08a41b181ce68.svg"
                data-src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/08a41b181ce68.svg"
                data-ll-status="loaded"></a><a class="social" title="Spotify"
            href="https://open.spotify.com/user/xaoxuu" target="_blank"
            rel="external nofollow noopener noreferrer"><img class="lazy entered loaded"
                src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/3845874.svg"
                data-src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/3845874.svg"
                data-ll-status="loaded"></a><a class="social" title="Unsplash"
            href="https://unsplash.com/@xaoxuu" target="_blank"
            rel="external nofollow noopener noreferrer"><img class="lazy entered loaded"
                src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/3616429.svg"
                data-src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/3616429.svg"
                data-ll-status="loaded"></a><a class="social" title="Comments" href="/about/#comments"
            rel="noopener noreferrer"><img class="lazy entered loaded"
                src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/942ebbf1a4b91.svg"
                data-src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.3/social/942ebbf1a4b91.svg"
                data-ll-status="loaded"></a></div>
</footer>
</div>
    </aside>
</div>

<style>

</style>
    <div class="loading-div" id="loading" style="display: none;">
    <div class="loading">
        <svg id="stage" viewBox="0 0 500 500" preserveAspectRatio="xMidYMid meet" stroke="#fff" stroke-width="3"
            stroke-linecap="round" fill="none"></svg>
        <span>加载中...</span>
    </div>
</div>
<style>
    .loading-div {
        position: absolute;
        display: flex;
        top: 0px;
        width: 100%;
        height: 100%;
        align-items: center;
        z-index: 20;
        animation-name: fadeIn;
        animation-duration: 2s;
        animation-fill-mode: forwards;
    }

    /*动画效果*/
    @keyframes fadeIn {
        from {
            backdrop-filter: blur(0px);
            background: rgba(0, 0, 0, 0);
        }

        to {
            backdrop-filter: blur(2px);
            background: rgb(0, 0, 0, 0.5);
        }
    }

    /*动画效果*/
    @keyframes fadeIn1 {
        from {
            filter: blur(1px);
        }

        to {
            filter: blur(0px);
        }
    }

    .loading {
        color: #fff;
        width: 250px;
        height: 250px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        align-content: center;
        flex-wrap: nowrap;
        flex-direction: column;
        animation-name: fadeIn1;
        animation-duration: 2s;
        animation-fill-mode: forwards;
    }

    svg {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        /* background: #000; */
    }
</style>
<script src="https://lib.baomitu.com/gsap/3.7.1/gsap.min.js"></script>
<script>
    let pts = [],
        nPts = 12,
        lineLength = 60,
        timeScale = 0.5

    const radius = 180,
        tl = gsap.timeline()

    for (let i = 0; i < nPts; i++) { // plot points + add circles
        const c = document.createElementNS("http://www.w3.org/2000/svg", "circle"),
            angle = (i / nPts * Math.PI * 2) - Math.PI / 2,
            x = Math.cos(angle) * radius,
            y = Math.sin(angle) * radius

        pts.push(x.toFixed(2) + ',' + y.toFixed(2) + ' ')

        gsap.set(c, {
            x: 250,
            y: 250,
            scale: 0.8,
            attr: {
                class: 'c' + i,
                r: 3,
                cx: x,
                cy: y,
                fill: '#fff',
                stroke: 'none'
            }
        })

        stage.appendChild(c);
    }


    for (let i = 0; i <= nPts; i++) { // add paths + animate
        const p = document.createElementNS("http://www.w3.org/2000/svg", "path")

        gsap.set(p, {
            x: 250,
            y: 250,
            attr: {
                class: 'line' + i,
                d: 'M' + pts[i] + ' C' + gsap.utils.wrap(pts, [i + 2]) + ' ' + gsap.utils.wrap(pts, [i - 5]) +
                    ' ' + gsap.utils.wrap(pts, [i - 2]),
                // d:'M'+pts[i]+' c 0,0 '+gsap.utils.wrap(pts,[i-nPts/2])+' '+gsap.utils.wrap(pts,[i-3]),
                'stroke-dasharray': lineLength + ' ' + lineLength,
                'stroke-dashoffset': lineLength
            },
        });

        stage.appendChild(p);

        const lineTL = gsap.timeline({
                repeat: -1,
                defaults: {
                    duration: 0.4
                }
            })
            .to(p, {
                attr: {
                    'stroke-dashoffset': -lineLength
                },
                ease: 'expo.inOut',
                duration: 0.6
            }, 0.4)

        if (i < nPts) {
            lineTL.to('.c' + i, {
                scale: 1.2,
                ease: 'expo.inOut'
            }, 0.1)
            lineTL.to('.c' + i, {
                scale: 0.8,
                ease: 'expo.in'
            }, 0.5)
        }

        tl.add(lineTL, 1 - i / nPts);
    }

    tl.play(5).timeScale(timeScale)
</script>
<script>
    $(function () {
        // loadingShow()
    })

    function loadingShow() {
        $("#loading").show();
    }

    function loadingHide() {
        $("#loading").hide();
    }
</script>

    <!-- <script src="https://cdn.bootcdn.net/ajax/libs/jquery.scrollbar/0.2.9/jquery.scrollbar.min.js"></script> -->
    <script>
        // $(document).ready(function () {
        //     $('.l_body').scrollbar({
        //         barWidth: 10, //滚动条的宽度(这里根据需要写数值即可，不设置是10,即默认10px)
        //         position: "x,y", //写“x”代表只出水平滚动条，写“y”表示只出垂直滚动条，写“x,y”则出水平和垂直滚动条（只有在内容超出容器时才出现滚动条）
        //         wheelDis: 15 //滚轮滚动一次向下或向上滚动的距离，默认是15，可根据需要修改数值
        //     });
        // });
    </script>
    <script>
        $('img').lazyload({
            threshold: 0,
            failure_limit: 0,
            event: "scroll", //触发事件
            effect: "show", //显示方式
            container: window, //容器
            data_attribute: "original", //属性
            skip_invisible: true,
            appear: null,
            load: null,
            placeholder: ""
        });
    </script>
<script>
            window.imageLazyLoadSetting = {
                isSPA: false,
                preloadRatio: 3,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(n){n.imageLazyLoadSetting.processImages=o;var e=n.imageLazyLoadSetting.isSPA,i=n.imageLazyLoadSetting.preloadRatio||1,r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]"));function o(){e&&(r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")));for(var t,a=0;a<r.length;a++)0<=(t=(t=r[a]).getBoundingClientRect()).bottom&&0<=t.left&&t.top<=(n.innerHeight*i||document.documentElement.clientHeight*i)&&function(){var t,e,n,i,o=r[a];t=o,e=function(){r=r.filter(function(t){return o!==t})},n=new Image,i=t.getAttribute("data-original"),n.onload=function(){t.src=i,e&&e()},t.src!==i&&(n.src=i)}()}o(),n.addEventListener("scroll",function(){var t,e;t=o,e=n,clearTimeout(t.tId),t.tId=setTimeout(function(){t.call(e)},500)})}(this);</script></body>